import React, { Component } from "react";

const WithKaikeba = Comp => {
  // 获取name
  const name = "高阶组件";
  return props => <Comp {...props} name={name}></Comp>;
};

const withLog = Comp => {
  console.log(Comp.name + "渲染了");

  return props => <Comp {...props}></Comp>;
};

@withLog
@WithKaikeba
@withLog
class Kaikeba extends React.Component {
  render() {
    return (
      <div>
        {this.props.stage}-{this.props.name}
      </div>
    );
  }
}

// const NewKaikeba = WithKaikeba(withLog(Kaikeba))

export default class Hoc extends Component {
  render() {
    return (
      <div>
        <Kaikeba stage="React"></Kaikeba>
      </div>
    );
  }
}
